#include <QDebug>

#include "protocol.h"
#include "babel.h"
#include "ui_babel.h"

void CSProtocol::Logout::sendTreat(TCPClient &connexion)
{
    CSProtocol::Header header = CSProtocol::Header();
    header.code = CSProtocol::Logout::code;
    header.dataLength = sizeof(CSProtocol::Logout);
    header.spontaneous = false;
    connexion.writeData(header, this);
}

void CSProtocol::Logout::receiveTreat(TCPClient &connexion, IData *data)
{
    (void)data;
    Babel * window = dynamic_cast<Babel *>(connexion.parent()->parent());
    window->setMaximumSize(1, 1);
    window->ui->navigationWidget->setCurrentIndex(0);
    window->ui->message->setText((static_cast<CSProtocol::Ok*>(data))->what);
    window->ui->message->show();
}

